<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Stimulus360.Controllers.Projects.ProjectPhotosViewModel>" %>

<%@ Import Namespace="Stimulus360.Models.Cms" %>
<%@ Import Namespace="Stimulus360.Models.Data.CustomTypes" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Stimulus360.Controllers" %>
<%@ Import Namespace="Stimulus360.Services" %>
<%@ Import Namespace="Stimulus360.Models.Data" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <%= Html.Css("style") %>
    <%= Html.Css("Pager") %>
    <%= Html.Css("jquery.rating")%>
    <%= Html.Css("jquery.lightbox-0.5","screen")%>
    <%= Html.Css("SlideshowStyles", "screen")%>
    <%=Html.Script("jquery-1.2.6.min")%>
    <%=Html.Script("jquery.pager")%>
    <%=Html.Script("jquery.rating")%>
    <%=Html.Script("jquery.lightbox-0.5")%>
    <%=Html.Script("jquery.aslideshow")%>   
    <%=Html.Script("PhotoSlideShow")%>
    <%=Html.Script("jquery.metadata")%>
    <%=Html.Script("common")%>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <% ProjectSummary project = Model.ProjectSummary;

       RatingViewModel ratingViewModel = new RatingViewModel
       {
           Id = project.ProjectId,
           AverageRating = project.AverageRating,
           IsDisabled = true,
           IdeaId = project.ProjectId
       };

       PaginatedCollection<ProjectPhoto> photoList = Model.Photos;
    
    %>
    <!-- Content Area Start -->
        <%Html.RenderPartial("ProjectDetailLeftNavigation", project); %>
        <div class="mainInner colViewHdr">
            <div>
            <div class="projListItem floatLeft p10">
                <h1><%=Model.ProjectSummary.ProjectTitle %></h1>
                <div class="projStatusBar mt10">
                    <div class="floatLeft pt02">
                        <%= Model.ProjectSummary.SubmittedDate.ToString("D", CultureInfo.CreateSpecificCulture("en-US"))%>
                        | PM: <%=Model.ProjectSummary.Submitter %></div>
                    <div class="projStatus floatLeft pl10">
                        <div>
                            <%Html.RenderPartial("Rating", ratingViewModel); %></div>
                        <div class="separatorR">
                            (<%=Model.ProjectSummary.UserRatingsCount %>)</div>
                        <div class="separatorR pt02">
                            Favorites
                            <%=Model.ProjectSummary.FavoritesCount%></div>
                        <div class="projStatusRpt">
                            <h4>
                                Status:
                            </h4>
                            <div>
                                &nbsp;<%= Html.Image(Model.ProjectSummary.StatusString.ToLower() + ".png", "") %>
                            </div>
                            <div class="statusWdth"><%=Model.ProjectSummary.StatusString %></div>
                        </div>
                        <br clear="all" />
                    </div>
                </div>
            </div>
            <div class="floatRight pt10 mr10">
                <a href="javascript:void(0);" id="viewSlideShow" class="headerLabelBtn"><span id="listslideshow">Slide Show</span></a>
            </div>
            <div class="floatRight pt10 ">
                <a href="/Projects/<%=project.ProjectId%>/Photos/Submit" class="headerLabelBtn"><span>Submit Photo</span></a>
            </div>
            <br clear="all" />
            </div>
            <h3>
                Photos</h3>
            <div id="MySlideshow" style="display: none;" class="photos">
                <%foreach (ProjectPhoto photo in photoList)
                  { %>
                    <div class="photospos" title="<div style='width=640;'><div class='pb5'><b>Title:</b> <%=photo.Title %> </div><b>Description: </b><%=photo.Description %></div>">
                    <img src="<%=Url.Action("Photo", "Projects", new {photoId=photo.PhotoId})%>" alt="<%=photo.Title %>" width="500px" height="500px" /></div>
                <%} %>
            </div>
            <div class="details" style="display: none">
            </div>
            <div class="projListItemBg" id="gallery">
                <ul>
                    <%foreach (ProjectPhoto photo in photoList)
                      { %>
                    <li><a href="<%=Url.Action("Photo", "Projects", new {photoId=photo.PhotoId})%>" title="<%=photo.Title %>" class="<%=photo.PhotoId %>">
                        <img src="<%=Url.Action("Photo", "Projects", new {photoId=photo.PhotoId})%>" width="116"
                            height="75" alt="" />
                        <h5>Title: <%=Html.GetTruncatedText(photo.Title, 12) %></h5>
                        </a>
                        <div id="<%=photo.PhotoId %>" style="display:none;"><span style='font-weight: bold;'><%=photo.Title %></span> <br /> By: <%=photo.SubmittedBy %> | Date: <%= photo.DateUploaded.ToString("D", CultureInfo.CreateSpecificCulture("en-US")) %></div>
                    </li>
                    <%} %>
                </ul>
                <br clear="all" />
            </div>
            <br clear="all" />
            <br />
            <div class="pagerbg">
                <div id="pagerPhotoList" class="pager">
                </div>
            </div>
            <br clear="all" />
        </div>
        <br clear="all" />
        
    <script type="text/javascript" language="javascript">
        $(document).ready(function() {

            $("#photosTag").addClass("selected");
            var totalPages_Photo = "<%=Model.Photos.TotalPages %>";
            var totalCount = "<%=Model.Photos.TotalCount %>";
            if (totalCount == 0) {
                $(".pagerbg").hide();
                $("#viewSlideShow").hide();
            }
            if (totalPages_Photo == 1 || totalPages_Photo == null) {
                $(".pagerbg").hide();
            }
            var currentPage = "<%=Model.Photos.PageIndex%>";
            $("#pagerPhotoList").pager({ pagenumber: currentPage, pagecount: totalPages_Photo, buttonClickCallback: PageClick_PhotoList });
        });
        PageClick_PhotoList = function(pageclickednuber) {
            var proj = "<%=Model.ProjectSummary.ProjectId%>";
            var pageIndex = pageclickednuber;
            window.location = "/Projects/" + proj.toString() + "/Photos/Page/" + pageIndex.toString();
        }
    </script>


</asp:Content>
